// pages/pages/mine/collect/collect.js
var api = require('../../../../service/api');
var app = getApp();
var apiUrl=app.apiUrl;
Page({
  /**
   * 页面的初始数据
   */
  data: {
    datas:[]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
  },
  ToSubject: function (e) {
    var id = parseInt(e.currentTarget.dataset.index);
    wx.navigateTo({
      url: '../subject/subject?id=' + id
    })
  }, 
  onShow: function (options){
    var that = this;
    wx.showLoading({
      title: '加载中...',
    })
    wx.request({
      url: 'https://www.wjp147.cn/e2face/collect/api_list?categoryId=0&userName=1995',
      method: "get",
      dataType: "json",
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        wx.hideLoading();
        console.log(res.data.resultInfo);
        if (res.data.resultCode == 111) {
          var data = res.data.resultDatas;
          that.setData({
            datas: data
          });
        }
      }, error: function () {
        wx.navigateTo({ url: '../index/index' })
      }
    })
  }
})